﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WFSample
{
    /// <summary>可用的按钮组合</summary>
    public enum ViewDialogButtons
    {
        None,
        Yes,
        YesNo,
        Close,
    }

    public partial class ViewDialog : UserControl
    {
        private ViewDialogButtons? _buttons;

        public ViewDialog()
        {
            InitializeComponent();
        }

        private void HideButtons()
        {
            this.commandPanel.Visible = false;
        }

        public ViewDialogButtons Buttons
        {
            get
            {
                return this._buttons.GetValueOrDefault(ViewDialogButtons.YesNo);
            }
            set
            {
                if (this._buttons.HasValue)
                    throw new NotSupportedException("只能设置一次");
                _buttons = new ViewDialogButtons?(value);
                switch (value)
                {
                    case ViewDialogButtons.None:
                        this.HideButtons();
                        break;
                    case ViewDialogButtons.Yes:
                        this.btnCancel.Visible = false;
                        break;
                    case ViewDialogButtons.Close:
                        btnConfirm.Visible = false;
                        btnConfirm.Text = "关闭";
                        break;
                }
            }
        }

        public bool ShowAsDialog { get; set; }



        private void btnConfirm_Click(object sender, EventArgs e)
        {
            innerContent.Controls.Add(new UserControl()
            {

            });
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

        }
    }
}
